import React, { Component, Suspense } from 'react'
import { Switch, Route } from 'react-router-dom'
export class RouterView extends Component {
  render() {
      const {routerConfig}=this.props
    return (
      <div>
          <Suspense fallback="路由加载中">
              <Switch>
                  {
                      routerConfig.length ? routerConfig.map((item,index)=>{
                          return <Route key={index} path={item.path} component={item.component}>
                              {/* {item.text} */}

                          </Route>
                      }) :'暂无路由'
                  }
              </Switch>

          </Suspense>
      </div>
    )
  }
}

export default RouterView